In [1]:
import numpy as np
import time
from scipy.stats import chi2
from matplotlib import pyplot as plt
from __future__ import division
from itertools import product
from spacetime.CA_Simulators.CAs import *
from spacetime.Local_Measures.Local_Complexity import *
from spacetime.Local_Measures.Spacetime_Information import *
%matplotlib inline

In [2]:
domain = ECA(18, domain_18(1000))
domain.evolve(1000)

In [6]:
domain.diagram()


Theoretically, the domain is just a checkerboard tiling of fixed 0 and wildcard. So there should be just two states, and depth 2 light cones should be sufficient.


In [ ]:

Let's try depth 2, with default $\alpha$


In [5]:
first_test = epsilon_field(domain.get_spacetime())
first_test.estimate_states(2,2,1)
first_test.filter_data()

In [6]:
print first_test.number_of_states()


4

In [13]:
for state in first_test.causal_states():
    print state.plc_configs()


['0']
['1100', '1001']
['0010']
['0101']

In [ ]:


In [4]:
second_test = epsilon_field(domain.get_spacetime())
second_test.estimate_states(2,2,1,alpha= 0)
second_test.filter_data()

In [8]:
print second_test.number_of_states()


4

In [14]:
for state in second_test.causal_states():
    print state.plc_configs()


['0']
['1001', '1100']
['0101']
['0010']

In [ ]:


In [9]:
big_domain = ECA(18, domain_18(2000))
big_domain.evolve(2000)

In [10]:
third_test = epsilon_field(big_domain.get_spacetime())
third_test.estimate_states(2,2,1,alpha=0)
third_test.filter_data()

In [11]:
print third_test.number_of_states()


4

In [16]:
for state in third_test.causal_states():
    print state.plc_configs()


['0010']
['1001', '1100']
['0101']
['0']

In [17]:
print 2**5


32

In [19]:
print np.size(np.unique(third_test.PLCs().all_labels()))


5

In [24]:
print np.size(np.unique(third_test.FLCs().all_labels()))


9

In [20]:
print third_test.causal_states()[0].plc_shape(0)


010
 0 


In [21]:
print third_test.causal_states()[1].plc_shape(0), '\n'
print third_test.causal_states()[1].plc_shape(1)


001
 1 


100
 1 


In [22]:
print third_test.causal_states()[2].plc_shape(0)


101
 0 


In [ ]:
diagram(domain.get_spacetime(), t_min = 400, t_max = 440, x_min = 400, x_max = 440)

In [25]:
print np.size([0,1]*10)


20

In [55]:
checkerish = ECA(18, ([0,0,1]+[0,1,0])*200)
checkerish.evolve(1200)

In [43]:
checkerish.diagram()



In [62]:
fourth_test = epsilon_field(checkerish.get_spacetime())
fourth_test.estimate_states(3,3,1)
fourth_test.filter_data()

In [63]:
print fourth_test.number_of_states()


6

In [64]:
for state in fourth_test.causal_states():
    print state.plc_configs()


['110000101']
['001001000']
['001000010']
['100110100']
['000001010']
['010110001']

Periodic, so probably not a good representation of the 18 domain


In [ ]:


In [ ]:

Look at depth 3 light cones


In [5]:
fifth_test = epsilon_field(domain.get_spacetime())
fifth_test.estimate_states(3,3,1, alpha=0)
fifth_test.filter_data()

In [8]:
print fifth_test.number_of_states()


4

In [9]:
print np.size(np.unique(fifth_test.PLCs().all_labels()))


11

In [12]:
for state in fifth_test.causal_states():
    print state.index(), state.plc_configs()


1 ['001000010', '000001010', '001001000']
2 ['100110100', '110000101', '110010000', '100100001']
3 ['0']
4 ['000010101', '010110001', '010100100']

In [24]:
for state in fifth_test.causal_states():
    print state.index(), state.morph_support_configs(), np.size(state.morph_support_configs()),'\n'


1 ['0', '000000010', '000001000', '000001010', '001000000', '001000010', '001001000', '001001010'] 8 

2 ['100000000', '100000001', '100010000', '100010001', '100100100', '100100101', '100110100', '100110101', '110000100', '110000101', '110010100', '110010101', '110100000', '110100001', '110110000', '110110001'] 16 

3 ['0', '000000001', '000000010', '000001000', '000001010', '000010000', '000010001', '000100100', '000100101', '000110100', '000110101', '001000000', '001000010', '001001000', '001001010', '010000100', '010000101', '010010100', '010010101', '010100000', '010100001', '010110000', '010110001'] 23 

4 ['0', '000000001', '000010000', '000010001', '000100100', '000100101', '000110100', '000110101', '010000100', '010000101', '010010100', '010010101', '010100000', '010100001', '010110000', '010110001'] 16 

Look at same stuff at depth 4 light cones


In [6]:
sixth_test = epsilon_field(domain.get_spacetime())
sixth_test.estimate_states(4,4,1,alpha = 0)
sixth_test.filter_data()

In [16]:
print sixth_test.number_of_states()


4

In [17]:
print np.size(np.unique(sixth_test.PLCs().all_labels()))


23

In [23]:
for state in sixth_test.causal_states():
    print state.index(), state.plc_configs(), '\n'


1 ['0'] 

2 ['1100100001000000', '1100100000010101', '1001000010000001', '1001101000010000', '1100001011010001', '1001000011010100', '1001101001000101', '1100001010000100'] 

3 ['0101100011000001', '0000000001010101', '0101100010010100', '0000101011000100', '0101001000000101', '0000101010010001', '0101001001010000'] 

4 ['0010010000100000', '0000000000101010', '0000010100100010', '0000010100001000', '0010000100101000', '0010010000001010', '0010000100000010'] 


In [21]:
for state in sixth_test.causal_states():
    print state.index(), state.morph_support_configs(), np.size(state.morph_support_configs()), '\n'


1 ['0', '0000000000000001', '0000000000000010', '0000000000100000', '0000000000100010', '0000000001000000', '0000000001000001', '0000000010000100', '0000000010000101', '0000000011000100', '0000000011000101', '0000000100001000', '0000000100001010', '0000000100101000', '0000000100101010', '0000010000001000', '0000010000001010', '0000010000101000', '0000010000101010', '0000010100000000', '0000010100000010', '0000010100100000', '0000010100100010', '0000100000010000', '0000100000010001', '0000100001010000', '0000100001010001', '0000100010010100', '0000100010010101', '0000100011010100', '0000100011010101', '0001001000010100', '0001001000010101', '0001001001010100', '0001001001010101', '0001001010010000', '0001001010010001', '0001001011010000', '0001001011010001', '0001101000000100', '0001101000000101', '0001101001000100', '0001101001000101', '0001101010000000', '0001101010000001', '0001101011000000', '0001101011000001', '0010000000000000', '0010000000000010', '0010000000100000', '0010000000100010', '0010000100001000', '0010000100001010', '0010000100101000', '0010000100101010', '0010010000001000', '0010010000001010', '0010010000101000', '0010010000101010', '0010010100000000', '0010010100000010', '0010010100100000', '0010010100100010', '0100001000010100', '0100001000010101', '0100001001010100', '0100001001010101', '0100001010010000', '0100001010010001', '0100001011010000', '0100001011010001', '0100101000000100', '0100101000000101', '0100101001000100', '0100101001000101', '0100101010000000', '0100101010000001', '0100101011000000', '0100101011000001', '0101000000000000', '0101000000000001', '0101000001000000', '0101000001000001', '0101000010000100', '0101000010000101', '0101000011000100', '0101000011000101', '0101100000010000', '0101100000010001', '0101100001010000', '0101100001010001', '0101100010010100', '0101100010010101', '0101100011010100', '0101100011010101'] 95 

2 ['1000000000000000', '1000000000000001', '1000000001000000', '1000000001000001', '1000000010000100', '1000000010000101', '1000000011000100', '1000000011000101', '1000100000010000', '1000100000010001', '1000100001010000', '1000100001010001', '1000100010010100', '1000100010010101', '1000100011010100', '1000100011010101', '1001001000010100', '1001001000010101', '1001001001010100', '1001001001010101', '1001001010010000', '1001001010010001', '1001001011010000', '1001001011010001', '1001101000000100', '1001101000000101', '1001101001000100', '1001101001000101', '1001101010000000', '1001101010000001', '1001101011000000', '1001101011000001', '1100001000010100', '1100001000010101', '1100001001010100', '1100001001010101', '1100001010010000', '1100001010010001', '1100001011010000', '1100001011010001', '1100101000000100', '1100101000000101', '1100101001000100', '1100101001000101', '1100101010000000', '1100101010000001', '1100101011000000', '1100101011000001', '1101000000000000', '1101000000000001', '1101000001000000', '1101000001000001', '1101000010000100', '1101000010000101', '1101000011000100', '1101000011000101', '1101100000010000', '1101100000010001', '1101100001010000', '1101100001010001', '1101100010010100', '1101100010010101', '1101100011010100', '1101100011010101'] 64 

3 ['0', '0000000000000001', '0000000001000000', '0000000001000001', '0000000010000100', '0000000010000101', '0000000011000100', '0000000011000101', '0000100000010000', '0000100000010001', '0000100001010000', '0000100001010001', '0000100010010100', '0000100010010101', '0000100011010100', '0000100011010101', '0001001000010100', '0001001000010101', '0001001001010100', '0001001001010101', '0001001010010000', '0001001010010001', '0001001011010000', '0001001011010001', '0001101000000100', '0001101000000101', '0001101001000100', '0001101001000101', '0001101010000000', '0001101010000001', '0001101011000000', '0001101011000001', '0100001000010100', '0100001000010101', '0100001001010100', '0100001001010101', '0100001010010000', '0100001010010001', '0100001011010000', '0100001011010001', '0100101000000100', '0100101000000101', '0100101001000100', '0100101001000101', '0100101010000000', '0100101010000001', '0100101011000000', '0100101011000001', '0101000000000000', '0101000000000001', '0101000001000000', '0101000001000001', '0101000010000100', '0101000010000101', '0101000011000100', '0101000011000101', '0101100000010000', '0101100000010001', '0101100001010000', '0101100001010001', '0101100010010100', '0101100010010101', '0101100011010100', '0101100011010101'] 64 

4 ['0', '0000000000000010', '0000000000100000', '0000000000100010', '0000000100001000', '0000000100001010', '0000000100101000', '0000000100101010', '0000010000001000', '0000010000001010', '0000010000101000', '0000010000101010', '0000010100000000', '0000010100000010', '0000010100100000', '0000010100100010', '0010000000000000', '0010000000000010', '0010000000100000', '0010000000100010', '0010000100001000', '0010000100001010', '0010000100101000', '0010000100101010', '0010010000001000', '0010010000001010', '0010010000101000', '0010010000101010', '0010010100000000', '0010010100000010', '0010010100100000', '0010010100100010'] 32 


In [ ]:


In [3]:
diagram(domain.get_spacetime(), t_min = 400, t_max = 440, x_min = 400, x_max = 440)


Look at states for increasing light cone size

2 (second test)

3 (fifth test)

4 (sixth test)


In [8]:
state_overlay_diagram(domain.get_spacetime(), second_test.get_causal_field(),\
                      t_min = 400, t_max = 440, x_min = 400, x_max = 440)



In [9]:
state_overlay_diagram(domain.get_spacetime(), fifth_test.get_causal_field(),\
                      t_min = 400, t_max = 440, x_min = 400, x_max = 440)



In [10]:
state_overlay_diagram(domain.get_spacetime(), sixth_test.get_causal_field(),\
                      t_min = 400, t_max = 440, x_min = 400, x_max = 440)



In [11]:
seventh_test = epsilon_field(domain.get_spacetime())
seventh_test.estimate_states(5,5,1,alpha=0)
seventh_test.filter_data()

In [12]:
print seventh_test.number_of_states()


4

In [13]:
state_overlay_diagram(domain.get_spacetime(), seventh_test.get_causal_field(),\
                      t_min = 400, t_max = 440, x_min = 400, x_max = 440)



In [ ]:


In [ ]:


In [ ]:


In [2]:
domain = ECA(18, domain_18(400))
domain.evolve(400)

In [3]:
domain_states = epsilon_field(domain.get_spacetime())
domain_states.estimate_states(5,3,1)
domain_states.filter_data()

In [4]:
print domain_states.number_of_states()


4

In [5]:
print domain_states.nonunifilar_transitions()


[(1, 'r:00000', 2), (1, 'l:00000', 2), (1, 'r:00000', 4), (1, 'l:00000', 4), (3, 'f:000000000', 2), (3, 'f:000000000', 4)]

In [6]:
state_overlay_diagram(domain.get_spacetime(), domain_states.get_causal_field(), t_min = 50, t_max = 100, \
                      x_min = 50, x_max = 100)



In [7]:
mask_field = np.copy(domain_states.get_causal_field())
mask_field[mask_field == 3] = 1

In [8]:
state_overlay_diagram(domain.get_spacetime(), mask_field, t_min = 50, t_max = 100, \
                      x_min = 50, x_max = 100)



In [12]:
print mask_field[10:30, 120:140]


[[1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2]
 [2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1]
 [1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2]
 [2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1]
 [1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 4 4 4 4 4]
 [2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 4 4 4 1]
 [1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 4 1 2]
 [2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1]
 [1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2]
 [2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1]
 [1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2]
 [2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 4 1 2 1]
 [1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2]
 [2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1]
 [1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2]
 [2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1]
 [1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2]
 [2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1]
 [1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2]
 [2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1]]

In [ ]:


In [ ]:


In [13]:
print len(domain_states.all_transitions())


109

In [ ]:


In [ ]:


In [ ]:


In [3]:
np.random.seed(0)
domain_states = epsilon_field(domain.get_spacetime())
domain_states.estimate_states(3,3,1)
domain_states.filter_data()

In [4]:
print domain_states.nonunifilar_transitions()


[(2, 'r:000', 1), (2, 'l:000', 1), (2, 'r:000', 4), (2, 'l:000', 4), (3, 'f:00000', 1), (3, 'f:00000', 4)]

In [5]:
print len(domain_states.all_transitions())


37

In [6]:
for transition in domain_states.all_transitions():
    print transition


(3, 'f:00000', 1)
(3, 'r:000', 1)
(3, 'l:000', 1)
(1, 'f:00011', 3)
(1, 'r:011', 3)
(1, 'l:010', 3)
(1, 'f:10110', 2)
(1, 'r:101', 2)
(1, 'l:011', 3)
(2, 'f:00000', 1)
(2, 'r:000', 1)
(2, 'l:000', 1)
(1, 'f:11010', 2)
(1, 'r:001', 3)
(1, 'l:110', 2)
(3, 'f:00000', 4)
(1, 'f:00000', 4)
(1, 'l:001', 3)
(1, 'f:10101', 2)
(1, 'r:110', 2)
(1, 'f:11001', 2)
(1, 'l:101', 2)
(1, 'f:01111', 3)
(1, 'f:01100', 3)
(1, 'r:100', 2)
(2, 'r:000', 4)
(4, 'f:11010', 2)
(4, 'r:000', 4)
(4, 'l:111', 2)
(4, 'f:00000', 4)
(4, 'l:000', 4)
(4, 'f:10101', 2)
(4, 'r:111', 2)
(2, 'l:000', 4)
(1, 'r:010', 3)
(1, 'l:100', 2)
(4, 'f:01111', 3)

In [ ]: